|
|
|
|
|
|
|
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Private Declare Function GetTimeZoneInformation Lib _
"kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
Private Const TIME_ZONE_ID_INVALID = &HFFFFFFFF
Private Const TIME_ZONE_ID_UNKNOWN = 0
Private Const TIME_ZONE_ID_STANDARD = 1
Private Const TIME_ZONE_ID_DAYLIGHT = 2
Private Sub Form_Load()
Dim tz As TIME_ZONE_INFORMATION
Dim info As String
Dim res As Long
res = GetTimeZoneInformation(tz)
Select Case res
Case TIME_ZONE_ID_INVALID
lblTimeZone.Caption = "GetTimeZoneInformation function failed." _
& vbCrLf
lblTimeZone.Caption = lblTimeZone.Caption & "Error: " _
& GetErrorString(Err.LastDllError)
Case TIME_ZONE_ID_UNKNOWN
lblTimeZone.Caption = "Time zone information unavailable."
Case TIME_ZONE_ID_STANDARD
info = "Currently on Standard Time" & vbCrLf
Case TIME_ZONE_ID_DAYLIGHT
info = "Currently on Daylight Savings Time" & vbCrLf
End Select
info = info & "Local time = UTC + " & tz.Bias / 60 & " hours" & vbCrLf |
|
|
|
|
|